<p>
<% if can?(:update, 'devices/reboot') %>
<div><a id="reboot" href="#" onclick="reboot();return false;">Reboot</a></div>
<% end %>
<% if can?(:update, 'devices/factory_reset') %>
<div><a id="factory-reset" href="#" onclick="factoryReset();return false;">Factory reset</a></div>
<% end %>
<% if can?(:update, 'devices/download') %>
<div class="filter_selection">
  <a id="push-file" href="#">Push file &raquo;</a>
  <div class="popup" style="bottom: 0;">
    <% for f in @files %>
    <a href="#" onclick="pushFile('<%= f['_id'] %>', '<%= f['filename'] %>');return false;"><%= f['filename'] %> (<%= f['metadata']['fileType'] %>)</a><br/>
    <% end %>
  </div>
</div>
<% end %>
<% if can?(:create, 'files') %>
<% software_version = @device['InternetGatewayDevice']['DeviceInfo']['SoftwareVersion']['_value'] rescue @device['Device']['DeviceInfo']['SoftwareVersion']['_value'] rescue '' %>
<div><%= link_to 'Add Firmware', {controller: 'files', action: 'new', params: {oui: @device['_deviceId']['_OUI'].html_safe, product_class: @device['_deviceId']['_ProductClass'].html_safe, version: software_version.html_safe }} %></div>
<% end %>

<% if can?(:delete, 'devices') %>
<div><%= link_to 'Delete', nil, method: :delete, data: {confirm: 'Are you sure you want to delete this device?'} %></div>
<% end %>
</p>
